<!--
 * @Author: @yzcheng
 * @Date: 2021-03-18 15:55:58
 * @Version: 1.0
 * @LastEditors: @yzcheng
 * @Description: 
 * @LastEditTime: 2021-03-19 15:33:42
-->
<template>
  <el-tabs type="border-card">
    <el-tab-pane label="待阅任务"><Waiting /></el-tab-pane>
    <el-tab-pane label="已阅任务"><Already /></el-tab-pane>
  </el-tabs>
  <Details v-model:visible="visible" />
</template>

<script>
import { mapActions } from "vuex";
import Already from "./components/already.vue";
import Waiting from "./components/waiting.vue";
import Details from "./components/details.vue";
import { readTask } from "../../api/reading";
export default {
  data() {
    return {
      visible: false,
    };
  },
  provide() {
    return {
      onShow: this.onShow,
    };
  },
  components: {
    Already,
    Waiting,
    Details,
  },

  computed: {},

  mounted() {
    this.copyTask()
  },

  methods: {
     ...mapActions("readingStore", ["copyTask",'readTask']),
    async onShow(row) {
      await this.readTask(row.id)
      await this.copyTask()
      this.visible = true;
    },
  },
};
</script>
<style lang="scss" scoped></style>
